package com.freewater.springboot.demo.resource.messagesource;

import org.jetbrains.annotations.NotNull;
import org.springframework.context.MessageSource;
import org.springframework.context.MessageSourceAware;

import java.util.Locale;

public class SomeService implements MessageSourceAware {

    private MessageSource messageSource;

    @Override
    public void setMessageSource(@NotNull MessageSource messageSource) {
        this.messageSource = messageSource;
    }

    public String execute(String arg, Locale locale) {
        return this.messageSource.getMessage("argument.required", new Object[]{arg}, locale);
    }
}
